/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author Minh Luc
 */
@Entity
@Table(name = "ClaimType", catalog = "P2PDB", schema = "dbo",uniqueConstraints={
     @UniqueConstraint(columnNames = {"ClaimTypeName"})
})
@NamedQueries({
    @NamedQuery(name = "ClaimType.findAll", query = "SELECT c FROM ClaimType c"),
    @NamedQuery(name = "ClaimType.findByClaimTypeId", query = "SELECT c FROM ClaimType c WHERE c.claimTypeId = :claimTypeId"),
    @NamedQuery(name = "ClaimType.findByClaimTypeName", query = "SELECT c FROM ClaimType c WHERE c.claimTypeName = :claimTypeName"),
    @NamedQuery(name = "ClaimType.findByClaimTypeDescription", query = "SELECT c FROM ClaimType c WHERE c.claimTypeDescription = :claimTypeDescription")})
public class ClaimType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ClaimTypeId", nullable = false)
    private Integer claimTypeId;
    @Column(name = "ClaimTypeName", length = 100)
    private String claimTypeName;
    @Column(name = "ClaimTypeDescription", length = 2147483647)
    private String claimTypeDescription;
    @OneToMany(mappedBy = "claimType")
    private Collection<Claim> claimCollection;

    public ClaimType() {
    }

    public ClaimType(Integer claimTypeId) {
        this.claimTypeId = claimTypeId;
    }

    public Integer getClaimTypeId() {
        return claimTypeId;
    }

    public void setClaimTypeId(Integer claimTypeId) {
        this.claimTypeId = claimTypeId;
    }

    public String getClaimTypeName() {
        return claimTypeName;
    }

    public void setClaimTypeName(String claimTypeName) {
        this.claimTypeName = claimTypeName;
    }

    public String getClaimTypeDescription() {
        return claimTypeDescription;
    }

    public void setClaimTypeDescription(String claimTypeDescription) {
        this.claimTypeDescription = claimTypeDescription;
    }

    public Collection<Claim> getClaimCollection() {
        return claimCollection;
    }

    public void setClaimCollection(Collection<Claim> claimCollection) {
        this.claimCollection = claimCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (claimTypeId != null ? claimTypeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ClaimType)) {
            return false;
        }
        ClaimType other = (ClaimType) object;
        if ((this.claimTypeId == null && other.claimTypeId != null) || (this.claimTypeId != null && !this.claimTypeId.equals(other.claimTypeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.ClaimType[claimTypeId=" + claimTypeId + "]";
    }

}
